# -*- coding: utf-8 -*-
import requests

url = 'http://www.baidu.com'


def encode_demo():
    response = requests.get(url)

    print(response.encoding)
    response.encoding = 'utf-8'
    print(response.text)  # str类型数据

    print(response.content)  # bytes类型数据
    print(response.content.decode('utf-8'))  # str类型数据


if __name__ == '__main__':
    encode_demo()
